package com.example.yyg.springframework.core.io;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

/**
 * @Author: 冰岩
 * @Date: 2023/07/02
 * @Description:
 */
public class FileSystemResource implements Resource{

    File file;

    String path;

    public FileSystemResource (File file) {
        this.file = file;
        this.path = file.getPath();
    }

    public FileSystemResource(String path) {
        File file = new File(path);
        this.path = path;
    }

    @Override
    public InputStream getInputStream() throws FileNotFoundException {
        return new FileInputStream(file);
    }
}
